<?php
class RedisDb extends Redis{

	private static $_instance;

	public function __construct( $config ){
		parent::__construct();
		$ip = $config['ip'];
		$port = $config['port'];
		$this->connect($ip, $port);
		$this->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
	}

	public static function instance( $config ){
		if( !isset(self::$_instance) ){
			self::$_instance = new RedisDb( $config );	
		}
		return self::$_instance;
	}

}

?>
